<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<style>
    #father {
        width: 200px;
        height: 200px;
        background: black;
        padding: 10px;
    }

    #child {
        width: 100px;
        height: 100px;
        background: greenyellow;
    }
</style>

<body>
    <div id="father">
        <div id="child"></div>
    </div>
    <script>
        document.getElementById("father").addEventListener("click", function () {
            alert("父级：" + this.id);
        }, true);

        document.getElementById("child").addEventListener("click", function () {
            alert("子级：" + this.id);
        }, true);
    </script>
</body>

<script>
    var json1 = {
        username: "吕布",
        age: 31
    };
    console.log("姓名：" + json1.username + "，年龄：" + json1.age + "岁"); // json数组 

    var josnarr = [{
        name: "貂蝉",
        age: 18
    }, {
        name: "小乔",
        age: 17
    }];
    console.log("貂蝉" + josnarr[0].age + "岁了");
    console.log("小乔" + josnarr[1].age + "岁了"); // 复杂的json对象 

    var long = {
        name: "赵云",
        sex: "男",
        hobby: ["玉兰白龙驹", "龙胆亮银枪", "青釭剑"]
    };
    console.log(long.name + "的主攻武器：" + long.hobby[1]);
</script>

</html>